package icu.thatyear.transmission.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * <p>Project: local-transmission - Result
 * <p>Powered by 16423 On 2024-11-11 15:12:51
 *
 * @author 16423 [cjy]
 * @version 1.0
 * @since 17
 */
@Data
@AllArgsConstructor
public class Result<E> {
    private int code;
    private String msg;
    private E data;

    public static <E> Result<E> success(E data) {
        return new Result<>(200, "success", data);
    }
    public static <E> Result<E> success(String msg){
        return new Result<E>(200, msg, null);
    }
    public static <E> Result<E> success(String msg, E data) {
        return new Result<>(200, msg, data);
    }
    public static <E> Result<E> err(String msg) {
        return new Result<>(500, msg, null);
    }
    public static <E> Result<E> err(int code, String msg) {
        return new Result<>(code, msg, null);
    }


}